package com.kexio.pay.dto;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 支付响应DTO
 * 
 * @author Kexio Team
 * @since 1.0.0
 */
public class PaymentResponse {
    
    /**
     * 是否成功
     */
    private boolean success;
    
    /**
     * 响应消息
     */
    private String message;
    
    /**
     * 错误码
     */
    private String errorCode;
    
    /**
     * 订单号
     */
    private String orderNo;
    
    /**
     * 第三方订单号
     */
    private String thirdPartyOrderNo;
    
    /**
     * 支付金额
     */
    private BigDecimal amount;
    
    /**
     * 支付方式
     */
    private String paymentMethod;
    
    /**
     * 支付状态
     */
    private String status;
    
    /**
     * 支付链接 (PC/WAP支付)
     */
    private String paymentUrl;
    
    /**
     * 二维码内容 (扫码支付)
     */
    private String qrCode;
    
    /**
     * 二维码图片Base64 (可选)
     */
    private String qrCodeImage;
    
    /**
     * 预支付ID (APP/小程序支付)
     */
    private String prepayId;
    
    /**
     * 支付参数 (JSON格式，用于前端调用)
     */
    private String paymentParams;
    
    /**
     * 跳转链接
     */
    private String redirectUrl;
    
    /**
     * 过期时间
     */
    private LocalDateTime expireTime;
    
    /**
     * 创建时间
     */
    private LocalDateTime createTime;
    
    /**
     * 扩展数据
     */
    private String extraData;
    
    // Constructors
    public PaymentResponse() {}
    
    public PaymentResponse(boolean success, String message) {
        this.success = success;
        this.message = message;
        this.createTime = LocalDateTime.now();
    }
    
    /**
     * 创建成功响应
     */
    public static PaymentResponse success(String orderNo, String message) {
        PaymentResponse response = new PaymentResponse(true, message);
        response.setOrderNo(orderNo);
        return response;
    }
    
    /**
     * 创建失败响应
     */
    public static PaymentResponse failure(String errorCode, String message) {
        PaymentResponse response = new PaymentResponse(false, message);
        response.setErrorCode(errorCode);
        return response;
    }
    
    // Getters and Setters
    public boolean isSuccess() { return success; }
    public void setSuccess(boolean success) { this.success = success; }
    
    public String getMessage() { return message; }
    public void setMessage(String message) { this.message = message; }
    
    public String getErrorCode() { return errorCode; }
    public void setErrorCode(String errorCode) { this.errorCode = errorCode; }
    
    public String getOrderNo() { return orderNo; }
    public void setOrderNo(String orderNo) { this.orderNo = orderNo; }
    
    public String getThirdPartyOrderNo() { return thirdPartyOrderNo; }
    public void setThirdPartyOrderNo(String thirdPartyOrderNo) { this.thirdPartyOrderNo = thirdPartyOrderNo; }
    
    public BigDecimal getAmount() { return amount; }
    public void setAmount(BigDecimal amount) { this.amount = amount; }
    
    public String getPaymentMethod() { return paymentMethod; }
    public void setPaymentMethod(String paymentMethod) { this.paymentMethod = paymentMethod; }
    
    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }
    
    public String getPaymentUrl() { return paymentUrl; }
    public void setPaymentUrl(String paymentUrl) { this.paymentUrl = paymentUrl; }
    
    public String getQrCode() { return qrCode; }
    public void setQrCode(String qrCode) { this.qrCode = qrCode; }
    
    public String getQrCodeImage() { return qrCodeImage; }
    public void setQrCodeImage(String qrCodeImage) { this.qrCodeImage = qrCodeImage; }
    
    public String getPrepayId() { return prepayId; }
    public void setPrepayId(String prepayId) { this.prepayId = prepayId; }
    
    public String getPaymentParams() { return paymentParams; }
    public void setPaymentParams(String paymentParams) { this.paymentParams = paymentParams; }
    
    public String getRedirectUrl() { return redirectUrl; }
    public void setRedirectUrl(String redirectUrl) { this.redirectUrl = redirectUrl; }
    
    public LocalDateTime getExpireTime() { return expireTime; }
    public void setExpireTime(LocalDateTime expireTime) { this.expireTime = expireTime; }
    
    public LocalDateTime getCreateTime() { return createTime; }
    public void setCreateTime(LocalDateTime createTime) { this.createTime = createTime; }
    
    public String getExtraData() { return extraData; }
    public void setExtraData(String extraData) { this.extraData = extraData; }
}
